package com.ruoyi.expert.service;

import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * Author 程家伟
 * Date 2022/3/1 20:07
 * Email 3497357686@qq.com
 */

@Service
public interface FileService {

    /**
     * 文件上传功能
     */
    public boolean upload(int id, String from, MultipartFile file);

    /**
     * 获取文件存储地址
     */
    public String getFilePath(String type);

    /**
     * 获取文件名
     */
    public String getFilename(int id,String from);

    /**
     * 将文件的url存入对应的表中
     */
    public void storageUrl(int id,String type,String from,String url);

    /**
     * 下载word文件
     */
    public void downloadFile(HttpServletRequest request,HttpServletResponse response);

    /**
     * 预览图片
     */
    public List<String> viewPicture(HttpServletRequest request, HttpServletResponse response);

    /**
     * 删除word文件
     */
    public boolean deleteWordFile(int id,String from);

    /**
     * 删除图片文件
     */
    public void deleteImage(int id,String from);

    /**
     *将图片转换为二进制
     */
    public String getImageBinary(String url);

    /**
     * 获取图片类型
     */
    public String getImageType(String url);

    /**
     * 获取图片类型列表
     */
    public List<String> getTypeLiat(HttpServletRequest request);


}
